﻿using System;
using UnityEngine.Audio;
using UnityEngine;
using LuaInterface;
using Object = UnityEngine.Object;

public class AudioMixerSnapshotWrap
{
	public static LuaMethod[] regs = new LuaMethod[]
	{
		new LuaMethod("TransitionTo", TransitionTo),
		new LuaMethod("New", _CreateAudioMixerSnapshot),
		new LuaMethod("GetClassType", GetClassType),
		new LuaMethod("__eq", Lua_Eq),
	};

	static LuaField[] fields = new LuaField[]
	{
		new LuaField("audioMixer", get_audioMixer, null),
	};

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int _CreateAudioMixerSnapshot(IntPtr L)
	{
		LuaDLL.luaL_error(L, "AudioMixerSnapshot class does not have a constructor function");
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int GetClassType(IntPtr L)
	{
		LuaScriptMgr.Push(L, typeof(AudioMixerSnapshot));
		return 1;
	}

	public static void Register(IntPtr L)
	{
		LuaScriptMgr.RegisterLib(L, "UnityEngine.Audio.AudioMixerSnapshot", typeof(AudioMixerSnapshot), regs, fields, typeof(UnityEngine.Object));
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_audioMixer(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);
		AudioMixerSnapshot obj = (AudioMixerSnapshot)o;

		if (obj == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name audioMixer");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index audioMixer on a nil value");
			}
		}

		LuaScriptMgr.Push(L, obj.audioMixer);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int TransitionTo(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 2);
		AudioMixerSnapshot obj = LuaScriptMgr.GetUnityObject<AudioMixerSnapshot>(L, 1);
		float arg0 = (float)LuaScriptMgr.GetNumber(L, 2);
		obj.TransitionTo(arg0);
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int Lua_Eq(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 2);
		Object arg0 = LuaScriptMgr.GetVarObject(L, 1) as Object;
		Object arg1 = LuaScriptMgr.GetVarObject(L, 2) as Object;
		bool o = arg0 == arg1;
		LuaScriptMgr.Push(L, o);
		return 1;
	}
}

